package com.demo.myapplication.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.demo.myapplication.R;
import com.demo.myapplication.activity.FirstActivity;
import com.demo.myapplication.utils.CommonUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class LaunchModeFragment extends Fragment {

  @BindView(R.id.btn_single_instance)
  Button btnSingleInstance;
  @BindView(R.id.btn_single_task)
  Button btnSingleTask;
  @BindView(R.id.btn_single_top)
  Button btnSingleTop;

  public static LaunchModeFragment newInstance(Bundle args) {
    LaunchModeFragment fragment = new LaunchModeFragment();
    fragment.setArguments(args);
    return fragment;
  }

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_lauch_mode, container, false);
    ButterKnife.bind(this, view);
    return view;
  }

  @OnClick(R.id.btn_single_instance)
  public void singleInstance(View v) {
    startActivity(new Intent(getActivity(), FirstActivity.class).putExtra(FirstActivity.EXTRA_LAUNCH_MODE, CommonUtils.LAUNCH_MODE.SINGLE_INSTANCE));
  }

  @OnClick(R.id.btn_single_task)
  public void singleTask(View v) {
    startActivity(new Intent(getActivity(), FirstActivity.class).putExtra(FirstActivity.EXTRA_LAUNCH_MODE, CommonUtils.LAUNCH_MODE.SINGLE_TASK));
  }

  @OnClick(R.id.btn_single_top)
  public void singleTop(View v) {
    startActivity(new Intent(getActivity(), FirstActivity.class).putExtra(FirstActivity.EXTRA_LAUNCH_MODE, CommonUtils.LAUNCH_MODE.SINGLE_TOP));
  }

}
